package core.form.dao.impl;

import org.springframework.stereotype.Repository;

import cn.org.rapid_framework.page.Page;
import core.base.action.BasePageRequest;
import core.base.dao.BaseSpringJdbcDao;
import core.form.dao.FormDao;
import core.form.model.Form;

@Repository
public class FormDaoImpl extends BaseSpringJdbcDao<Form, String> implements FormDao {

	public void saveForm(Form form) {
		super.save(form);
	}

	public void deleteForm(String id) {
		super.deleteById(id);
	}

	public void deleteForms(String[] ids) {
		for (int i = 0; i < ids.length; i++) {
			super.deleteById(ids[i]);
		}
	}

	public void updateForm(Form form) {
		super.update(form);
	}

	public void saveOrupdateForm(Form form) {
		super.saveOrUpdate(form);
	}

	public Form findForm(String id) {
		return super.getById(id);
	}
	
	public Page<Form> queryForms(BasePageRequest pageRequest) {
		String query = "SELECT * FROM T_FORM";
		return super.pageQuery(query, pageRequest);
	}

	@Override
	public Class<Form> getEntityClass() {
		return Form.class;
	}
}
